from typing import *


class Solution:

    def maximumJumps(self, nums: List[int], target: int) -> int:
        n = len(nums)
        dp = [-1] * n
        dp[0] = 0
        for i in range(1, n):
            for j in range(i):
                if dp[j] != -1 and nums[i] - nums[j] >= -target and nums[i] - nums[
                        j] <= target:
                    dp[i] = max(dp[i], dp[j] + 1)
        
        return dp[n - 1]
    
s = Solution()
print(s.maximumJumps(nums = [1,3,6,4,1,2], target = 2))